package sixth.group.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sixth.group.dao.LogsMapper;
import sixth.group.domain.Logs;
import sixth.group.service.LogsService;

@Service
public class LogsServiceimpl implements LogsService {
@Autowired
private LogsMapper logsMapper;

    @Override
    public boolean addLog(Logs log) {
        int i=logsMapper.insertSelective(log);
        if(i<1) return false;

        System.out.println("日志添加"+i+"新纪录！");
        String role;
        if(log.getLrole()==1)role="商家";
        else if (log.getLrole()==2) role="顾客";
        else role="管理员";

        System.out.println(role+" "+log.getLusername()+" "+"在"+log.getLuptime()+"时进行了"+log.getLtype()+"类型的操作，详细内容："+log.getLoperation());
        return true;

    }
}
